<template>
	<view class="page" v-if="loadding" :style="{minHeight:windowHeight+'px'}">
		<!-- <view class="page-head-box">
			<view class="page-head">
				<view class="page-head-img">
					<image class="location" src="../../static/dafaulthead2.png" v-if="detail.avatarUrl == '' "></image>
				
				</view>
				<view class="page-head-input" @click="showMulLinkageThreePicker">
					<text class="page-head-Select">{{location}}</text>		
					<image class="select-img"  src="../../static/app/jiaotou2.png"></image>
				</view>
			</view>
			<view class="head-banner">
				<swiper :indicator-dots="true" circular=""  :autoplay="true" :interval="3000" :duration="1000">				
					<swiper-item class="swiper-item" v-for="(item,index) in 5" :key="index">
						<image src="../../static/app/banner.png" mode=""></image>
					</swiper-item>
				</swiper>
			</view>
		</view>
		<view class="page-nav">
			<view  v-for="(item,index) in pageNav" :key="index">
				<view class="page-nav-img">
					<image :src="item.icon"> </image>
				</view>
				<view class="page-nav-title">
					{{item.name}}
				</view>
			</view>			
		</view>
		<view class="userCar">
			<view class="userCar-head">
				<view class="userCar-head-left">
					<view>二手车推荐</view>
				</view>
				<view class="userCar-head-right">
					<text>更多</text>
					<image src="../../static/jiantou3.png"></image>
				</view>
			</view>
			<view class="userCar-item">
				<view>
					<view class="product" v-for="(item,index) of car" @click="gotoDetail(item.car_id)">
						<image class="product-image" :src="item.thumb"></image>
						<text class="product-name">{{item.brand_id}}</text>
						<text class="product-introduce">{{item.content}}</text>			
						<text class="product-price">&yen {{item.discharge}}</text>
					</view> 
				</view>
			</view>
		</view>
		 -->

		<!-- <view>用户端首页</view> -->
		<view class="head">
			<!-- <view style="height: 90rpx"></view> -->
			<view class="head-item">
				<view class="head-item-con1">
					<image src="../../static/location2.png"></image>
					<input disabled="" v-model="location" v-if="location != ''" />
					<input placeholder="重新定位" @click="getLocation()" disabled="" v-if="location == ''" />
				</view>
				<view class="head-item-con2">
					联合拉
				</view>
				<view></view>
			</view>
			<view class="head-item1" >
				<view class="head-item1-con2">
					<view class="begin">
						<view class="dot"></view>
						<input class="origin" disabled="" @click="selectLocation('star',-1)" v-model="begin.b_name"
							placeholder="请选择上车地点" />
					</view>
					<view class="begin middle" v-for="(item,index) of middle">
						<view class="middle-left" >
							<!-- <view class="dot "></view> -->
							<view class="close" @click="delectMiddle(index)">
								<image src="../../static/close.png"></image>
							</view>
							<input @click="selectLocation('mid',index)" class="origin middle-left-content" disabled="" :value="item.m_name" placeholder="请选择停靠点" />
						</view>
						
					</view>
					<view class="end-box">
						<view class="begin end">
							<!-- <view class="dot dot-censer">
								<view></view>
							</view> -->
							<view class="end-box-yh">
								<image src="../../static/user/icon-yh.png"></image>
							</view>
							<input class="origin origin2" disabled="" @click="selectLocation('end',-1)"
								v-model="destination.d_name" placeholder="请选择下车地点" />
						</view>
						<image class="addImage" @click="add" src="../../static/user/add.png"></image>
					</view>
				</view>
				<view class="head-item1-con1">
					<view class="starTime starTime1">
						<image class="starTime-ima1" src="../../static/user/icon-time.png"></image>
						<!-- <view>请选择上车时间</view> -->
						<!-- <input placeholder="请选择上车时间" /> -->
						<picker class="starTime-select" mode="multiSelector" :range="dateTimeArray" v-model="dateTime" @change="change"
							@columnchange="columnchange">
								<!-- <input  type="text" disabled="true" v-if="star_time ==''"
									placeholder="请选择出发时间" placeholder-class="inputPlace" /> -->
									<view class="starTime-select-con1" v-if="star_time==''">请选择出发时间</view>
									<view class="star_time" v-else>{{star_time}}</view>
									
						</picker>
						<image class="starTime-ima2" src="../../static/jiantou3.png"></image>
					</view>
					<view class="starTime"> 
						<!-- <input class="starTime-day" placeholder="包车天数" /> -->
						<picker class="starTime-day" @change="bindPickerChange2" :range="array2">
							<input placeholder="包车天数" disabled="" v-if="selectDay==''" />
							<view class="starTime-day-con" v-if="selectDay!=''">已选择{{array2[index2]}}天</view>
							<!-- <label class="">{{array2[index2]}}</label>	 -->	
						</picker>
						<!-- <view>包车天数</view> -->
						<image class="starTime-ima2" src="../../static/jiantou3.png"></image>
					</view>
				</view>
				<!-- <view class="head-item1-con1">
					<view class="starTime">
						<text class="noweek">请选择上车时间</text>
					</view>
					<view class="dayNum">
						<image src="../../static/user/jiantou.png"></image>
					</view>
					<view class="starTime">
						<text class="noweek">请选择结束时间</text>
					</view>
					<view class="starTime">
						<view class="starTime">
							<input class="noweek" type="text" disabled="true" v-model="formData.end_time"
								placeholder="用车结束时间" placeholder-class="inputPlace" />
						</view>
						<picker mode="multiSelector" :range="dateTimeArray" v-model="dateTime" @change="change2"
							@columnchange="columnchange2">
							<view class="starTime">
								<input class="noweek" type="text" disabled="true" v-model="formData.end_time"
									placeholder="用车结束时间" placeholder-class="inputPlace" />
							</view>
						</picker>
					</view>
				</view> -->
				
				<view class="sure" @click="gotoCustom">定制行程</view>
			</view>

		</view>
		<!-- <view>
			<view class="userCar-head">
				<view class="userCar-head-left">
					<view>二手车推荐</view>
				</view>
				<view class="userCar-head-right" @click="gotoPage('/pagesUser/user-car/user-car')">
					<text>更多</text>
					<image src="../../static/jiantou3.png"></image>
				</view>
			</view>
			<view class="userCar-item">
				<view class="product" v-for="(item,index) of car">
					<image class="product-image" :src="item.thumb"></image>
					<text class="product-name">{{item.brand_id}}</text>
					<text class="product-introduce">{{item.content}}</text>			
					<text class="product-price">&yen {{item.discharge}}</text>
				</view> 
			</view>
		</view> -->
		<view class="item2">
			<view class="userCar-head">
				<view class="userCar-head-left">
					<view>服务优势</view>
				</view>
				<!-- <view class="userCar-head-right" @click="gotoPage('')">
					<text>了解详情</text>
					<image src="../../static/jiantou3.png"></image>
				</view> -->
			</view>
			<view class="superiority">
				<view></view>
				<view class="superiority-item">
					<view class="superiority-item-for" v-for="(item,index) of navseviData" :key="index">
						<view class="superiority-item-con" @click="serviceDetail(item.article_id)">
							<view class="superiority-item-con-image">
								<image :src="item.image.file_path"></image>
							</view>
							<view class="superiority-item-con-wz">
								<view >{{item.article_title}}</view>
								<text v-html="item.article_content"></text>
								<!-- <text>sfdfs丢了饭卡的发射点你发射丢了饭卡的发射点你发射点发顺丰丢了饭卡的发射点你发射点发顺丰点发顺丰</text> -->
							</view>
						</view>
					</view>
					<!-- <view class="superiority-item-con" @click="">
						<view class="superiority-item-con-image">
							<image src="../../static/user/home-icon1.png"></image>
						</view>
						<view class="superiority-item-con-wz">
							<view >车源丰富</view>
							<text>车队、运输公司<br />深度合作</text>
						</view>
					</view>
					<view class="superiority-item-con superiority-item-con2">
						<view class="superiority-item-con-image superiority-item-con-image2">
							<image src="../../static/user/home-icon2.png"></image>
						</view>
						
						<view class="superiority-item-con-wz">
							<view >价格实惠</view>
							<text>直接沟通交流<br />一对一议价</text>
						</view>
					</view>
					<view class="superiority-item-con superiority-item-con22">
						<view class="superiority-item-con-image superiority-item-con-image3">
							<image src="../../static/user/home-icon3.png"></image>
						</view>
						<view class="superiority-item-con-wz">
							<view >无忧服务</view>
							<text>免费取消、修改订单</text>
						</view>
					</view>
					<view class="superiority-item-con superiority-item-con2 superiority-item-con22">
						<view class="superiority-item-con-image">
							<image src="../../static/user/hemo-icon3.png"></image>
						</view>
						
						<view class="superiority-item-con-wz">
							<view >用车保障</view>
							<text>证据齐全，司机持证上岗</text>
						</view>
					</view> -->
				</view>
				<!-- <view class="superiority-item superiority-item2">
					<view class="superiority-item-con">
						<view class="superiority-item-con-image superiority-item-con-image3">
							<image src="../../static/user/home-icon3.png"></image>
						</view>
						<view class="superiority-item-con-wz">
							<view >无忧服务</view>
							<text>免费取消、修改订单</text>
						</view>
					</view>
					<view class="superiority-item-con superiority-item-con2">
						<view class="superiority-item-con-image">
							<image src="../../static/user/hemo-icon3.png"></image>
						</view>
						
						<view class="superiority-item-con-wz">
							<view >用车保障</view>
							<text>证据齐全，司机持证上岗</text>
						</view>
					</view>
				</view> -->
			</view>
		</view>
		<view class="showCar">
			<view class="userCar-head">
				<view class="userCar-head-left">
					<view>车辆展示</view>
				</view>
				<!-- <view class="userCar-head-right" @click="gotoPage('/pagesUser/user-car/user-car')">
					<text>更多</text>
					<image src="../../static/jiantou3.png"></image>
				</view> -->
			</view>
			<view class="userCar-item">
				<view class="product" v-for="(item,index) of listData" :key="index">
					<image class="product-image" :src="item.car_info4"></image>
					<!-- <text class="product-name">{{item.brand_id}}</text>
					<text class="product-introduce">{{item.content}}</text>			
					<text class="product-price">&yen {{item.discharge}}</text> -->
				</view>
			</view>
		</view>
		<!-- <view class="item-content">
			<view class="item-con-head">
				<view class="item-con-head-left">
					<text>订单号：111111111111111</text>
					<view class="">
						天数
					</view>
				</view>
				<view class="item-con-head-status">
					待出行
				</view>
			</view>
			<view class="item-con-box">
				<view class="item-con-begin">
					<view>起始地</view>
					<view class="item-con-begin-time">11:00</view>
				</view>
				<view class="item-con-begin item-con-time">
					<view>08月12日</view>
					<view>
						<hr />
					</view>
					<view>
						<text>16 座</text>
						<text class="hx"> | </text>
						<text>16 人</text>
					</view>
				</view>
				<view class="item-con-begin">
					<view>终点</view>
					<view class="item-con-begin-time">17:00</view>
				</view>
			</view>
		</view> -->

		<view class="service">
			<view class="service-icon" @click="showPhone">
				<image src="../../static/service.png"></image>
			</view>
		</view>
		<view class="mask" v-show="isShow"></view>
		<view class="bottom-dialog-wrap" v-show="isShow">
			<view class="info-wrap" @click="phoneCall">
				<view class="info-item">
					<image src="../../static/app/phone.png" mode=""></image>
					<text>
						咨询电话:{{phone}}
					</text>
				</view>
			</view>
			<view class="dialog-btn" @click="closePhone">
				取消
			</view>
		</view>
		<!-- <view class="d-c-c p30" v-if="listData.length == 0">
			<text class="iconfont icon-wushuju"></text>
			<text class="cont">亲，暂无相关记录哦</text>
		</view> -->
		<view v-show="isLoadMore">
			<uni-load-more :loadingType="loadding2"></uni-load-more>
		</view>
		
		<mpvue-city-picker ref="mpvueCityPicker" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onConfirm">
		</mpvue-city-picker>
		<view style="height: 160rpx;"></view>
		<footTabber></footTabber>


	</view>
</template>

<script>
	import uniLoadMore from '../../components/uni-load-more.vue';
	import mpvueCityPicker from '@/components/mpvue-citypicker/mpvueCityPicker.vue';
	import dateTimePicker from '../../common/dateTimePicker.js'
	export default {
		// 注册组件
		components: {
			mpvueCityPicker,
			uniLoadMore
		},
		data() {
			return {
				loadding: false,
				loadding2: 0,
				isLoadMore: false, //是否加载中
				page: 1,
				pagesize: 1,
				detail: {
					avatarUrl: '', //头像
				},
				cityPickerValueDefault: [0, 0, 0],
				selectCity: '',
				formData: {
					star_time: '', //时间
					//end_time: '', //用车介绍时间
					days: '', //天数
				},
				star_time:'',
				time: '',
				dateTimeArray: null,
				dateTime: null,
				startYear: 2000,
				endYear: 2050,
				upTower: '',
				dating: '',
				isShow: false,
				phone: '0773-2625000',
				windowHeight: '', //视高
				location: '', //定位
				begin: {
					b_name: '', //位置名称
					b_address: '', //详细地址
					b_latitude: '', //纬度
					b_longitude: '', //经度
				}, //起点的位置
				destination: {
					d_name: '', //位置名称
					d_address: '', //详细地址
					d_latitude: '', //纬度
					d_longitude: '', //经度
				}, //终点
				addNum: 0, //标记点的次数
				middle: [],
				middleInfo: {},
				wayPoiStr: [], //标记点的经纬度
				a1: 0,
				car: '',
				userCar_id: '',
				windowHeight: '',
				car_info3: [], //车辆的第一张图片
				timer: null,
				att_info: '', //用户认证信息
				Certified: [], //认证的车辆
				listData: [],
				navseviData:[],
				array2:['0.5',],
				index2: 0,
				selectDay:'',
			};
		},
		onLoad() {
			let self = this;
			self.getLocation();
			//this.getLocation();
			uni.getSystemInfo({
				success: (res) => {
					self.windowHeight = res.windowHeight;
					//console.log(res.windowWidth)
				}
			});
			this.date1();
			let obj = dateTimePicker.dateTimePicker(this.startYear, this.endYear, this.dating)
			this.dateTimeArray = obj.dateTimeArray
			this.dateTime = obj.dateTime
			let i = 1;
			for( i;i<=1000;i++){
				self.array2.push(i)
				
			}
		},
		onShow() {
			this.getPhone();
			this.getData();
			this.getAttInfo();
			this.getLocation();
			this.getCar();
			this.getAdvantage();
		},
		onPullDownRefresh() {
			this.page = 1;
			this.listData = [];
			this.getLocation();
			this.getPhone();
			this.getData();
			this.getAttInfo();
			this.getCar();
			this.getAdvantage();
			setTimeout(() => {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onReachBottom() { //上拉触底函数
			if (!this.isLoadMore) { //此处判断，上锁，防止重复请求
				this.isLoadMore = true
				this.page += 1
				this.getCar();
			}
		},
		methods: {
			serviceDetail(id){
				let self = this;
				console.log(id);
				uni.navigateTo({
					url:'/pagesUser/home/detail/detail?select=1&id='+id
				})
				// uni.showLoading({
				// 	title: '加载中'
				// });
				// self._get('plus.article.article/detail', {
				// 		article_id: id
				// 	},
				// 	function(res) {
				// 		self.about = res.data.detail; 
				// 		self.loadding = true;
				// 		uni.hideLoading();
					//});
			},
			/* 获取已认证的车辆接口 */
			getCar() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('car.index/car_list', {
					page: self.page,
					pageSize:self.pagesize
				}, function(res) {
					//self.Certified = res.data.list.data;
					if (res.data.list.data) {
						self.listData = self.listData.concat(res.data.list.data)
						if (res.data.list.data.length < res.data.list.per_page) { //判断接口返回数据量小于请求数据量，则表示此为最后一页
							self.isLoadMore = true
							self.loadding2 = 2
							
						} else {
							self.isLoadMore = false
						}
					} else {
						self.isLoadMore = true
						self.loadding2 = 2
					}
					uni.hideLoading();
					//self.loadding = true;
				});
			},
			/* 获取用户认证接口 */
			getAttInfo() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('user.user/attestation_info', {}, function(res) {
					self.att_info = res.data.info;
					uni.hideLoading();
					self.loadding = true;
				});
			},
			/*获取数据*/
			getData() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('user.index/user_car', {
						type: 1
					},
					function(res) {
						//console.log(res);
						self.car = res.data.car;
						self.car.forEach(item => {
							var pics = item.car_info3.split(",");
							item.thumb = pics[0];
						})

						self.loadding = true;
						uni.hideLoading();
					});
			},
			gotoCustom() {
				let self = this;
				let formData = [];
				let begin = [];
				let destination = [];
				let middle = [];
				//self.formData.push(self.begin)
				formData.push(JSON.stringify(self.formData))
				begin.push(JSON.stringify(self.begin))
				destination.push(JSON.stringify(self.destination))
				middle.push(JSON.stringify(self.middle))
				//formData.push(JSON.stringify(self.begin))
				//console.log(formData)
				//return;
				if (self.att_info == null) {
					uni.showModal({
						title: '您还未认证，请前去认证。',
						success: (res) => {
							if (res.confirm) {
								uni.navigateTo({
									url: '/register/approve/approve'
								})
							} else if (res.cancel) {
								return;
								//console.log('quexiao')
							}
						}
					})
				} else if (self.att_info != null && self.att_info.status == 0) {
					uni.showModal({
						title: '温馨提示',
						content: '您认证的信息正在审核中',
					})
					return;
				} else if (self.att_info != null && self.att_info.status == 2) {
					uni.showModal({
						title: '您认证的信息审核中未通过，请重新认证。',
						success: (res) => {
							if (res.confirm) {
								if (self.att_info.types == 1) {
									uni.navigateTo({
										url: '/register/approve-person/approve-person?select=1&&type=1'
									})
								} else if (self.att_info.types == 2) {
									uni.navigateTo({
										url: '/register/approve-firm/approve-firm?select=1&&type=2'
									})
								} else if (self.att_info.types == 3) {
									uni.navigateTo({
										url: '/register/approve-travel/approve-travel?select=1&&type=3'
									})
								}

							} else if (res.cancel) {
								return;
							}
						}
					})
				} else if (self.att_info != null && self.att_info.status == 1) {
					uni.navigateTo({
						url: '/pagesUser/home/custom-car/custom-car?select=1&formData='+formData+'&begin='+begin+'&destination='+destination+'&middle='+middle
					});
				}
			},
			/*三级联动选择*/
			showMulLinkageThreePicker() {
				this.$refs.mpvueCityPicker.show();
			},
			/*确定选择的省市区*/
			onConfirm(e) {
				this.selectCity = e.label;
				this.province_id = e.cityCode[0];
				this.city_id = e.cityCode[1];
				this.region_id = e.cityCode[2];
				var str = this.selectCity.replace(/,/, "1");
				var str1 = str.indexOf("1");
				var str2 = str.indexOf(",");
				var str3 = str.substring(str1 + 1, str2);
				this.location = str3;
			},
			/* 获取手机号码 */
			getPhone() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('index/config', {}, function(res) {
					self.phone = res.data.service_phone;
					self.loadding = true;
					uni.hideLoading();
				});
			},
			/* 获取服务优势 */
			getAdvantage() {
				let self = this;
				uni.showLoading({
					title: '加载中'
				});
				self._post('plus.article.article/get_advantage', {}, function(res) {
					//self.phone = res.data.service_phone;
					self.navseviData = res.data.list;
					self.loadding = true;
					uni.hideLoading();
				});
			},
			showPhone() {
				let self = this;
				self.isShow = true;
			},
			closePhone() {
				let self = this;
				self.isShow = false;
			},
			/* 拨打电话 */
			phoneCall() {
				let self = this;
				uni.makePhoneCall({
					phoneNumber: self.phone
				});
			},
			gotoPage(path) {
				let self = this;
				if (path.startsWith('/')) {
					uni.navigateTo({
						url: path
					});
				} else {
					self[path]();
				}
			},
			selectLocation(type, index) {
				//console.log(555);return;
				uni.navigateTo({
					url: "choose-location/choose-location?select=1&type=" + type + '&index=' + index,
					animationType: "slide-in-bottom",
				})
			},
			confirmPoint(type, point, index) {
				let self = this;
				if (type == 'star') {
					self.begin.b_name = point.name;
					self.begin.b_address = point.address;
					self.begin.b_latitude = point.point.latitude;
					self.begin.b_longitude = point.point.longitude;
					self.p_star = point.point.longitude + ',' + point.point.latitude;
				} else if (type == 'end') {
					self.destination.d_name = point.name;
					self.destination.d_address = point.address;
					self.destination.d_latitude = point.point.latitude;
					self.destination.d_longitude = point.point.longitude;
					self.p_end = point.point.longitude + ',' + point.point.latitude;
					//self.calDistance();
				} else if (type == 'mid') {
					self.middle[index].m_name = point.name;
					self.middle[index].m_address = point.address;
					self.middle[index].m_latitude = point.point.latitude;
					self.middle[index].m_longitude = point.point.longitude;
					// if (self.destination.d_name != '') {
					// 	self.calDistance();
					// }
				}
			},
			/* 添加标记点 */
			add() {
				if (this.begin.b_name == '') {
					uni.showToast({
						title: '请先选择上车地点',
						duration: 2000,
						icon: 'none'
					});
					return;
				}
				this.addNum += 1;
				let addMiddle = {
					m_name: '', //位置名称
					m_address: '', //详细地址
					m_latitude: '', //纬度
					m_longitude: '', //经度
				};
				this.middle.push(addMiddle);
			},
			// /* 删除标记点 */
			// delectMiddle(idx) {
			// 	this.middle.splice(idx, 1)
			// },
			// /* 添加标记点 */
			// add() {
			// 	this.addNum += 1;
			// 	let addMiddle = {
			// 		m_name: '', //位置名称
			// 		m_address: '', //详细地址
			// 		m_latitude: '', //纬度
			// 		m_longitude: '', //经度
			// 	};
			// 	this.middle.push(addMiddle);
			// },
			// /* 获取标记点的位置信息 */
			// middleLocation(index) {
			// 	let self = this;
			// 	uni.chooseLocation({
			// 		success: function(res) {
			// 			// let arr = {
			// 			// 	m_name: res.name, //位置名称
			// 			// 	m_address: res.address, //详细地址
			// 			// 	m_latitude: res.latitude, //纬度
			// 			// 	m_longitude: res.longitud, //经度
			// 			// };
			// 			// self.middle.push(arr)
			// 			console.log(res.name)
			// 			self.middle[index].m_name = res.name;
			// 			self.middle[index].m_address = res.address;
			// 			self.middle[index].m_latitude = res.latitude;
			// 			self.middle[index].m_longitude = res.longitude;
			// 		}
			// 	});
			// 	//let aa = {};
			// 	console.log(self.middle)
			// },
			// /* 获取起点的位置 */
			// beginLocation() {
			// 	let self = this;
			// 	uni.chooseLocation({
			// 		success: function(res) {
			// 			self.begin.b_name = res.name;
			// 			self.begin.b_address = res.address;
			// 			self.begin.b_latitude = res.latitude;
			// 			self.begin.b_longitude = res.longitude;
			// 		}
			// 	});
			// },
			// /* 获取终点的位置 */
			// endLocation() {
			// 	let self = this;
			// 	uni.chooseLocation({
			// 		success: function(res) {
			// 			self.destination.d_name = res.name;
			// 			self.destination.d_address = res.address;
			// 			self.destination.d_latitude = res.latitude;
			// 			self.destination.d_longitude = res.longitude;
			// 		}
			// 	});
			// },
			/* 获取当前位置 */
			getLocation() {
				let self = this;
				uni.getLocation({
					type: 'wgs84',
					geocode: true,
					success: function(res) {
						self.location = res.address.city;
					},
					fail: function(res) {

					}
				});
			},
			sure() {
				let self = this;
				let a = [];
				self.middle.forEach(item => {
					a += item.m_longitude + "," + item.m_latitude + ";";
				});
				self.wayPoiStr = a.substring(0, a.length - 1)				
				self.middleInfo = self.middle;
				let waypoistr = self.wayPoiStr;
				let lineInformation = JSON.stringify(self.middle)
				let star_address = JSON.stringify(self.begin)
				let end_address = JSON.stringify(self.destination)
				//console.log(middle)
				self._post('order.carorder/add', {
						star_address,
						lineInformation,
						end_address,
						waypoistr
					},
					function(res) {

					})
			},
			/* 获取当前的时间 */
			date1() {
				let today = new Date();
				let year = today.getFullYear()
				let month = today.getMonth() + 1;
				let day = today.getDate()
				let h = today.getHours();
				let m = today.getMinutes();
				let s = today.getSeconds(); // 在小于10的数字钱前加一个‘0’
				h = checkTime(h);
				m = checkTime(m);
				s = checkTime(s);
				month = checkTime(month)
				day = checkTime(day)
			
				function checkTime(i) {
					if (i < 10) {
						i = "0" + i;
					}
					return i;
				}
				let temp = `${year}/${month}/${day} ${h}:${m}`;
				this.dating = temp;
				//this.arr = temp;
				this.startYear = `${year}`;
				//console.log(temp)
			},
			//时间格式化
			withData(param) {
				return param < 10 ? '0' + param : '' + param;
			},
			/* 时间 */
			change(e) {
				//console.log(e)
				this.date1();
				let value = []
				e.detail.value.forEach((val, index) => {
					value.push(this.dateTimeArray[index][val])
				})
				let dateArray = value[0] + "-" + value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				let dateArray2 = value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
				this.formData.star_time = dateArray
				this.star_time = dateArray2;
				if (this.formData.star_time != '') {
					var d3 = new Date(this.dating.replace(/-/g, '/'));
					var d1 = new Date(this.formData.star_time.replace(/-/g, '/'));
					//var d2 = new Date(this.formData.end_time.replace(/-/g, '/'));
					//var ms = Math.abs(d2.getTime() - d1.getTime()); //毫秒
					//var d = ms / 1000 / 60 / 60 / 24; //转为天
					//this.formData.days = Math.ceil(d);
					this.Adate = d3.getTime(); //当前时间
					//this.Adate2 = d2.getTime(); //所选择的结束时间+4个小时
					this.Adate3 = d1.getTime(); //所选择的开始时间
					console.log(dateArray)
				}
			},
			/* 时间 */
			columnchange(e) {
				let dateArr = this.dateTimeArray
				let arr = this.dateTime
				arr[e.detail.column] = e.detail.value
				dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]])
				this.dateTimeArray = dateArr
				this.dateTime = arr
			},
			/* 选择包车天数 */
			bindPickerChange2(e){
				//console.log(e)
				this.index2 = e.target.value	
				this.selectDay = this.array2[e.target.value]
				this.formData.days = this.selectDay;
			}
			// /* 时间 */
			// change2(e) {
			// 	//console.log(e)
			// 	let value = []
			// 	e.detail.value.forEach((val, index) => {
			// 		value.push(this.dateTimeArray[index][val])
			// 	})
			// 	let dateArray = value[0] + "-" + value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
			// 	let dateArray2 = value[1] + "-" + value[2] + " " + value[3] + ":" + value[4]
			// 	this.formData.end_time = dateArray2
			// 	if(this.formData.end_time != ''){
			// 		var d1 = new Date(this.formData.star_time.replace(/-/g, '/'));
			// 		var d2 = new Date(this.formData.end_time.replace(/-/g, '/'));
			// 		var ms = Math.abs(d2.getTime() - d1.getTime()); //毫秒
			// 		var d = ms / 1000 / 60 / 60 / 24; //转为天
			// 		this.days = d;
			// 	}

			// 	console.log(d)
			// 	//console.log(dateArray2)
			// },
			// /* 时间 */
			// columnchange2(e) {
			// 	let dateArr = this.dateTimeArray
			// 	let arr = this.dateTime
			// 	arr[e.detail.column] = e.detail.value
			// 	dateArr[2] = dateTimePicker.getMonthDay(dateArr[0][arr[0]], dateArr[1][arr[1]])
			// 	this.dateTimeArray = dateArr
			// 	this.dateTime = arr
			// },
		}
	}
</script>

<style lang="scss">
	@import 'home.scss';
</style>
